//===============================================================================
// Microsoft patterns & practices Enterprise Library Contribution
// Data Access Application Block
//===============================================================================

using System;
using System.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Configuration;

namespace EntLibContrib.Data.SQLite
{
	/// <summary>
	/// Represents the process to build an instance of <see cref="SQLiteDatabase"/>
	/// described by configuration information.
	/// </summary>
	/// <remarks>
	/// Revision 1: Steve Phillips  Date: 25 Nov 2009 - Updated to use EntLib 4.1 core
	/// </remarks>
	public class SQLiteDatabaseAssembler : IDatabaseAssembler
	{
		#region Public Methods
		/// <summary>
		/// Builds an instance of the concrete subtype of <see cref="Database"/> the receiver knows how to build, based on
		/// the provided connection string and any configuration information that might be contained by the
		/// <paramref name="configurationSource"/>.
		/// </summary>
		/// <param name="name">The name for the new database instance.</param>
		/// <param name="connectionStringSettings">The connection string for the new database instance.</param>
		/// <param name="configurationSource">The source for any additional configuration information.</param>
		/// <returns>The new SQLite database instance.</returns>
		public Database Assemble(string name,
														ConnectionStringSettings connectionStringSettings,
														IConfigurationSource configurationSource)
		{
			return new SQLiteDatabase(connectionStringSettings.ConnectionString);
		}
		#endregion
	}
}
